package com.ruoyi.common.core.exception.base.exception;

import com.ruoyi.common.core.enums.BaseEnum;
import com.ruoyi.common.core.enums.ResultEnum;
import lombok.Data;

@Data
public class BaseRuntimeException extends RuntimeException {
    private static final long serialVersionUID = -159433994674523022L;
    private String code;
    private String message;

    public BaseRuntimeException() {
        this(ResultEnum.ERROR);
    }

    public BaseRuntimeException(BaseEnum baseEnum) {
        this(baseEnum.getCode(),baseEnum.getMessage());
    }

    public BaseRuntimeException(String message) {
        this(ResultEnum.ERROR.getCode(),message);
    }

    public BaseRuntimeException(String code, String message) {
        this.code = code;
        this.message = message;
    }
}
